import com.sun.javafx.logging.JFRInputEvent;

import java.io.FilterOutputStream;
import java.util.Random;
import java.util.Scanner;

public class apihomework1 {
  //  1. 生成一个4位验证码(数字和字母的组合)，输出到控制台并提示用户输入验证码，输入后若正确则提示验证码正确，若错误则提示验证码错误。注意：不区分大小写
  public static void main(String[] args) {
      String fin = "";
      for (int i = 0 ; i < 4 ; i++){
          String line = "1234567890abcdefghijkllmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ";
          Random random = new Random();
          int a = random.nextInt(line.length());
          char c = line.charAt(a);
          fin += c;
      }
      System.out.println(fin);
      Scanner scanner = new Scanner(System.in);
      String guess = scanner.nextLine();
      if (guess.toUpperCase().equals(fin.toUpperCase())){
          System.out.println("验证码正确");
      }else {
          System.out.println("验证码错误");
      }
  }
}
